package com.peanut.sql.lineage.postgresql;

import java.util.Objects;

/****
 author:yifan
 date:2016
 description:
 **/
public class PGFunction extends Vertex {
    private String functionName;
    //自定义函数
    private String sourceCode;
    private String codeBlock;
    private String schemaName;
    private String databaseName;

    public PGFunction() {
    }

    public PGFunction(String functionName, String sourceCode, String codeBlock, String schemaName, String databaseName) {
        this.functionName = functionName;
        this.sourceCode = sourceCode;
        this.codeBlock = codeBlock;
        this.schemaName = schemaName;
        this.databaseName = databaseName;
    }

    public String getFunctionName() {
        return functionName;
    }

    public void setFunctionName(String functionName) {
        this.functionName = functionName;
    }

    public String getSourceCode() {
        return sourceCode;
    }

    public void setSourceCode(String sourceCode) {
        this.sourceCode = sourceCode;
    }

    public String getCodeBlock() {
        return codeBlock;
    }

    public void setCodeBlock(String codeBlock) {
        this.codeBlock = codeBlock;
    }

    public String getSchemaName() {
        return schemaName;
    }

    public void setSchemaName(String schemaName) {
        this.schemaName = schemaName;
    }

    public String getDatabaseName() {
        return databaseName;
    }

    public void setDatabaseName(String databaseName) {
        this.databaseName = databaseName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        PGFunction that = (PGFunction) o;
        return Objects.equals(functionName, that.functionName) &&
                Objects.equals(sourceCode, that.sourceCode) &&
                Objects.equals(codeBlock, that.codeBlock) &&
                Objects.equals(schemaName, that.schemaName) &&
                Objects.equals(databaseName, that.databaseName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(functionName, sourceCode, codeBlock, schemaName, databaseName);
    }

    @Override
    public String toString() {
        return functionName;
    }
}
